package Spil;

import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

public class FieldGUI extends JFrame implements ActionListener {

	private JPanel panel = new JPanel();
	private JLabel l1 = new JLabel(Txt.FieldGUI);
	private JButton b1 = new JButton (Txt.Yes);
	private JButton b2 = new JButton (Txt.No);
	private boolean wait;
	private String Answer;

	public FieldGUI() {
	
		this.wait = false;

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setSize(260, 150);

		add(panel);

		panel.setBackground(new Color(47,175,13));

		l1.setFont(new Font("Arial", Font.PLAIN,18));

		b1.setFont(new Font("Arial", Font.PLAIN,18));
		b2.setFont(new Font("Arial", Font.PLAIN,18));
		
		b1.setPreferredSize(new Dimension(70, 40));
		b2.setPreferredSize(new Dimension(70, 40));
		
		panel.add (l1);
		panel.add (b1);
		panel.add (b2);
		
		b1.addActionListener(this);
		b2.addActionListener(this);
		
	}
		
		public void actionPerformed(ActionEvent evt) {
			if (evt.getSource() == b1) {
				this.Answer = "Ja";
				setVisible(false);
				this.wait = true;
			}
			else if (evt.getSource() == b2) {
				this.Answer = "Nej";
				setVisible(false);
				this.wait = true;
			}
		
	}
		
		public String getAnswer() {
			return this.Answer;
		}

		public boolean getWait() {
			return this.wait;
		}
}
